home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t_gen / t_gen.lha / misc-changes.r4.0.st < prev    next >
Text File  |  1993-07-19  |  8KB  |  259 lines

  1.  
  2. !Object methodsFor: 'copyrights'!
  3.  
  4. tgenCopyright
  5.     "Bring up a read-only text window with the T-gen copyright notice."
  6.     "Object tgenCopyright"
  7.  
  8.     | copyright aComposedTextView topView |
  9.     copyright := 'The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose.  This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy.
  10.  
  11. This software is copyright (c) 1992 by Justin O. Graver.
  12. All rights reserved, except as specified below.
  13.  
  14. Permission is hereby granted to use, copy, modify, and distribute this software (or portions thereof) for any purpose, without fee, subject to these conditions:
  15. (1) If any part of the source code for this software is distributed, then this notice must be included, unaltered; and any additions, deletions, or changes to the original files must be clearly indicated in accompanying documentation.
  16. (2) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind.
  17.  
  18. Permission is NOT granted for the use of any author''s name in advertising or publicity relating to this software or products derived from it.
  19.  
  20. We specifically permit and encourage the use of this software as the basis of commercial products, provided that all warranty or liability claims are assumed by the product vendor.
  21.  
  22. Developed under the direction of Justin Graver.
  23. Authors include: Justin Graver, Virat Hanvivatpong, and David Wilson.
  24.  
  25. Send any comments, suggestions, or defects to: graver@comm.mot.com.'.
  26.  
  27.     aComposedTextView := ComposedTextView model: copyright.
  28.     topView := ScheduledWindow new.
  29.     topView controller model: aComposedTextView model.
  30.     topView component: (LookPreferences edgeDecorator on: aComposedTextView).
  31.     topView label: TranslatorGenerator versionName , ' Copyright Notice'.
  32.     topView minimumSize: 470 @ 550.
  33.     aComposedTextView controller: NoController new.
  34.     topView open! !
  35.  
  36. !TranslatorGenerator methodsFor: 'status text'!
  37.  
  38. statusTextBufferMenu
  39.     "TranslatorGenerator flushMenus"
  40.  
  41.     ^StatusTextBufferMenu isNil
  42.         ifTrue: [StatusTextBufferMenu := ActionMenu
  43.                         labels: 'again\undo\copy\cut\paste\accept\cancel\result\builder\grammar\parser\scanner\install\save specs\load specs' withCRs
  44.                         lines: #(2 5 7 12 13)
  45.                         selectors: #(#again #undo #copySelection #cut #paste #accept #cancel #inspectResult #defineTreeBuilderClass #inspectGrammar #inspectParser #defineScannerClass #installScannerAndParserClasses #saveSpecs #loadSpecs)]
  46.         ifFalse: [StatusTextBufferMenu]! !
  47.  
  48.  
  49. !TranslatorGenerator methodsFor: 'grammar text'!
  50.  
  51. textMenu
  52.     "Answer an ActionMenu of operations on the source code that is to be 
  53.     displayed when the operate menu button is pressed."
  54.     "TranslatorGenerator flushMenus"
  55.  
  56.     ^TextMenu isNil
  57.         ifTrue: [TextMenu := ActionMenu
  58.                         labels: 'again\undo\copy\cut\paste\accept\cancel' withCRs
  59.                         lines: #(2 5 )
  60.                         selectors: #(#again #undo #copySelection #cut #paste #alwaysAccept #cancel )]
  61.         ifFalse: [TextMenu]! !
  62.  
  63.  
  64. !TranslatorGeneratorView methodsFor: 'private-subview creation'!
  65. addGrammarModeView: area on: aModel 
  66.  
  67.     | buttonViews |
  68.     buttonViews := OrderedCollection new.
  69.     buttonViews
  70.          add: (self
  71.                     label: 'LL(1)'
  72.                     model: aModel
  73.                     getSelector: #grammarMode
  74.                     putSelector: #setGrammarMode:
  75.                     selectorValue: aModel llModeMarker);
  76.          add: (self
  77.                     label: 'SLR(1), LALR(1), LR(1)'
  78.                     model: aModel
  79.                     getSelector: #grammarMode
  80.                     putSelector: #setGrammarMode:
  81.                     selectorValue: aModel lrModeMarker);
  82.          add: (self
  83.                     label: 'don''t care'
  84.                     model: aModel
  85.                     getSelector: #grammarMode
  86.                     putSelector: #setGrammarMode:
  87.                     selectorValue: aModel defaultModeMarker).
  88.     self
  89.         add: (DialogView new
  90.                 addRow: buttonViews
  91.                 fromX: 0
  92.                 toX: 1
  93.                 collect: [:each | each wrapper])
  94.         in: area!
  95.  
  96. addParserModeView: area on: aModel 
  97.  
  98.     | buttonViews |
  99.     buttonViews := OrderedCollection new.
  100.     buttonViews
  101.          add: (self
  102.                     label: 'Derivation'
  103.                     model: aModel
  104.                     getSelector: #parserMode
  105.                     putSelector: #setParserMode:
  106.                     selectorValue: aModel defaultModeMarker);
  107.          add: (self
  108.                     label: 'Trace'
  109.                     model: aModel
  110.                     getSelector: #parserMode
  111.                     putSelector: #setParserMode:
  112.                     selectorValue: aModel traceModeMarker);
  113.          add: (self
  114.                     label: 'sham AST'
  115.                     model: aModel
  116.                     getSelector: #parserMode
  117.                     putSelector: #setParserMode:
  118.                     selectorValue: aModel shamAstModeMarker);
  119.          add: (self
  120.                     label: 'AST'
  121.                     model: aModel
  122.                     getSelector: #parserMode
  123.                     putSelector: #setParserMode:
  124.                     selectorValue: aModel astModeMarker).
  125.     self
  126.         add: (DialogView new
  127.                 addRow: buttonViews
  128.                 fromX: 0
  129.                 toX: 1
  130.                 collect: [:each | each wrapper])
  131.         in: area! !
  132.  
  133.  
  134. TextController subclass: #TranscriptController
  135.     instanceVariableNames: ''
  136.     classVariableNames: ''
  137.     poolDictionaries: ''
  138.     category: 'Tools-Transcript'!
  139. TranscriptController comment:
  140. '=================================================
  141.     Copyright (c) 1992 by Justin O. Graver.
  142.     All rights reserved (with exceptions).
  143.     For complete information evaluate "Object tgenCopyright."
  144. =================================================
  145.  
  146. I provide the necessary methods to emulate the behavior of TextCollectorController.  This behavior is needed for TranscriptView, the pluggable version of TextCollectorView.'!
  147.  
  148.  
  149. !TranscriptController methodsFor: 'entry control'!
  150.  
  151. appendEntry: aString 
  152.  
  153.     self deselect.
  154.     self text size > 2000 ifTrue: [self removeFirstChars: self text size - 1000].
  155.     self selectAt: paragraph text size + 1.
  156.     self replaceSelectionWith: aString asText.
  157.     self selectAt: paragraph text size + 1.
  158.     self selectAndScroll.
  159.     self deselect!
  160.  
  161. clear
  162.  
  163.     self changeParagraph: ComposedText new! !
  164.  
  165.  
  166. TextView subclass: #UpdateRequestTextView
  167.     instanceVariableNames: 'updatePrompt '
  168.     classVariableNames: ''
  169.     poolDictionaries: ''
  170.     category: 'Interface-Text'!
  171. UpdateRequestTextView comment:
  172. '=================================================
  173.     Copyright (c) 1992 by Justin O. Graver.
  174.     All rights reserved (with exceptions).
  175.     For complete information evaluate "Object tgenCopyright."
  176. =================================================
  177.  
  178. This class allows users to specify the confirmation message used when a "May one of your dependents change?" update request is received.
  179.  
  180. Instance Variables
  181.  
  182.     updatePrompt    <String> - prompt text used when update request is received.'!
  183.  
  184.  
  185. !UpdateRequestTextView methodsFor: 'updating'!
  186.  
  187. updateRequest
  188.     "Answer regarding whether the receiver may change."
  189.  
  190.     ^self controller textHasChanged
  191.         ifTrue: [DialogView confirm: self updatePrompt]
  192.         ifFalse: [true]! !
  193.  
  194. !UpdateRequestTextView methodsFor: 'state accessing'!
  195.  
  196. updatePrompt
  197.  
  198.     ^updatePrompt!
  199.  
  200. updatePrompt: argument 
  201.  
  202.     updatePrompt := argument! !
  203. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  204.  
  205. UpdateRequestTextView class
  206.     instanceVariableNames: ''!
  207.  
  208.  
  209. !UpdateRequestTextView class methodsFor: 'instance creation'!
  210.  
  211. on: anObject aspect: aspectMsg change: changeMsg menu: menuMsg updatePrompt: aString 
  212.  
  213.     | aView |
  214.     aView := self new.
  215.     aView
  216.         on: anObject
  217.         aspect: aspectMsg
  218.         change: changeMsg
  219.         menu: menuMsg.
  220.     aView updatePrompt: aString.
  221.     ^aView! !
  222.  
  223.  
  224. NonrelianceTextView subclass: #TranscriptView
  225.     instanceVariableNames: ''
  226.     classVariableNames: ''
  227.     poolDictionaries: ''
  228.     category: 'Tools-Transcript'!
  229. TranscriptView comment:
  230. '=================================================
  231.     Copyright (c) 1992 by Justin O. Graver.
  232.     All rights reserved (with exceptions).
  233.     For complete information evaluate "Object tgenCopyright."
  234. =================================================
  235.  
  236. This class implements a pluggable version of TextView.  It can be used like a Transcript (i.e. a TextCollector).'!
  237.  
  238.  
  239. !TranscriptView methodsFor: 'updating'!
  240.  
  241. update: aSymbol 
  242.  
  243.     | text |
  244.     aSymbol == partMsg
  245.         ifTrue: 
  246.             [text := self getContents.
  247.             ^controller appendEntry: text].
  248.     aSymbol == #clear ifTrue: [^controller clear]! !
  249.  
  250. !TranscriptView methodsFor: 'controller access'!
  251.  
  252. defaultControllerClass
  253.  
  254.     ^TranscriptController! !
  255.  
  256.  
  257.  
  258.  
  259.